package only.my.railgunys.artifact;

import only.my.railgunys.bean.Character;
import only.my.railgunys.bean.SubStatProperties;
import org.springframework.beans.BeanUtils;

public class EffectiveSubStatRoll {
    boolean atkUseful;
    boolean critRateUseful;
    boolean critDmgUseful;
    boolean defenceUseful;
    boolean rechargeUseful;
    boolean masteryUseful;
    boolean hpUseful;

    int atkTimes;
    int hpTimes;
    int defenseTimes;
    int critRateTimes;
    int critDmgTimes;
    int masteryTimes;
    int rechargeTimes;

    public EffectiveSubStatRoll(int atkTimes,int critRateTimes,int critDmgTimes){
        this.atkTimes= atkTimes;
        this.critDmgTimes= critDmgTimes;
        this.critRateTimes = critRateTimes;
    }

    public EffectiveSubStatRoll(int atkTimes, int defenseTimes, int critRateTimes, int critDmgTimes){
        this.atkTimes= atkTimes;
        this.defenseTimes = defenseTimes;
        this.rechargeTimes = defenseTimes;
        this.critDmgTimes= critDmgTimes;
        this.critRateTimes = critRateTimes;
    }
    public EffectiveSubStatRoll(int atkTimes, int masteryTimes,int rechargeTimes, int critRateTimes, int critDmgTimes){
        this.atkTimes= atkTimes;
        this.masteryTimes = masteryTimes;
        this.rechargeTimes = rechargeTimes;
        this.critDmgTimes= critDmgTimes;
        this.critRateTimes = critRateTimes;
    }

    public Character enhanceCharacter(Character temp){
        Character c = new Character();
        BeanUtils.copyProperties(temp,c);
        c.setSubStatProperties(new SubStatProperties());
        attackSubStat(c,atkTimes);
        critRateSubStat(c,critRateTimes);
        critDmgSubStat(c,critDmgTimes);
        defenseSubStat(c, defenseTimes);
        rechargeSubStat(c, rechargeTimes);
        masterySubStat(c, masteryTimes);
        return c;
    }


    public int getAtkTimes() {
        return atkTimes;
    }

    public void setAtkTimes(int atkTimes) {
        this.atkTimes = atkTimes;
    }

    public int getHpTimes() {
        return hpTimes;
    }

    public void setHpTimes(int hpTimes) {
        this.hpTimes = hpTimes;
    }

    public int getCritRateTimes() {
        return critRateTimes;
    }

    public void setCritRateTimes(int critRateTimes) {
        this.critRateTimes = critRateTimes;
    }

    public int getCritDmgTimes() {
        return critDmgTimes;
    }

    public void setCritDmgTimes(int critDmgTimes) {
        this.critDmgTimes = critDmgTimes;
    }

    public static void attackSubStat(Character character, int times){
        character.addAtk(5D*times);
        character.subStatProperties.atk+=times;
    }
    public static void rechargeSubStat(Character character,int times){
        character.addRecharge(5.5*times);
        character.subStatProperties.recharge+=times;
    }
    public static void hpSubStat(Character character,int times){
        character.addHp(character.getHp()*0.05*times);
        character.subStatProperties.hp+=times;
    }
    public static void masterySubStat(Character character,int times){
        character.addMastery(20*times);
        character.subStatProperties.mastery+=times;
    }
    public static void defenseSubStat(Character character,int times){
        character.addDefense(6.2*times);
        character.subStatProperties.defence+=times;
    }
    public static void critDmgSubStat(Character character,int times){
        character.addCritDmg(6.6*times);
        character.subStatProperties.critDmg+=times;
    }
    public static void critRateSubStat(Character character,int times){
        character.addCritRate(3.3*times);
        character.subStatProperties.critRate+= times;
    }

    public boolean isAtkUseful() {
        return atkUseful;
    }

    public void setAtkUseful(boolean atkUseful) {
        this.atkUseful = atkUseful;
    }

    public boolean isCritRateUseful() {
        return critRateUseful;
    }

    public void setCritRateUseful(boolean critRateUseful) {
        this.critRateUseful = critRateUseful;
    }

    public boolean isCritDmgUseful() {
        return critDmgUseful;
    }

    public void setCritDmgUseful(boolean critDmgUseful) {
        this.critDmgUseful = critDmgUseful;
    }

    public boolean isDefenceUseful() {
        return defenceUseful;
    }

    public void setDefenceUseful(boolean defenceUseful) {
        this.defenceUseful = defenceUseful;
    }

    public boolean isRechargeUseful() {
        return rechargeUseful;
    }

    public void setRechargeUseful(boolean rechargeUseful) {
        this.rechargeUseful = rechargeUseful;
    }

    public boolean isMasteryUseful() {
        return masteryUseful;
    }

    public void setMasteryUseful(boolean masteryUseful) {
        this.masteryUseful = masteryUseful;
    }

    public boolean isHpUseful() {
        return hpUseful;
    }

    public void setHpUseful(boolean hpUseful) {
        this.hpUseful = hpUseful;
    }
}
